#include "Clock.h"
using namespace Timing;
bool Clock::initialize()
{
	BOOL b = QueryPerformanceFrequency(&timeFrequency);
	if(!b)
		return false;

	return (bool)QueryPerformanceCounter(&timeLastFrame);
}
bool Clock::shutdown()
{
	return true;
}


void Clock::newFrame()
{
	LARGE_INTEGER thisTime,delta;
	QueryPerformanceCounter(&thisTime);
	delta.QuadPart = thisTime.QuadPart - timeLastFrame.QuadPart;
	deltaTime =  ((float)delta.QuadPart)/ timeFrequency.QuadPart;
	timeLastFrame.QuadPart = thisTime.QuadPart;
}

float Clock::timeElapsedLastFrame() const 
{
	return deltaTime;
}

